package cn.phonevane.action;


import java.util.List;

import cn.phonevane.base.BaseAction;
import cn.phonevane.model.TArticleType;
import cn.phonevane.service.TypeService;

public class TypeAction extends BaseAction{
	
	private TypeService typeService;
	
	public TypeService getTypeService() {
		return typeService;
	}

	public void setTypeService(TypeService typeService) {
		this.typeService = typeService;
	}

	public String create(){
		String typename=httpServletRequest.getParameter("typename");
		String typedescribe=httpServletRequest.getParameter("typedescribe");
		TArticleType tType=new TArticleType();
		tType.setArticleTypeName(typename);
		tType.setArticleTypeDescribe(typedescribe);
		boolean sign=this.typeService.add(tType);
		if(sign==true){
			return SUCCESS;
		}
		return ERROR;
	}
	
	public String get(){
		
	  	List<TArticleType> tTypeList=this.typeService.get();
		if(tTypeList!=null&&tTypeList.size()>0){
			httpServletRequest.setAttribute("TYPE_LIST", tTypeList);
			return SUCCESS;
		}
		return ERROR;
		
	}

}
